<?php
declare (strict_types = 1);

namespace app\controller\api\v1\expert\order;

use app\controller\api\ApiController;
use app\exception\LogicException;
use app\service\logic\common\order\OrderConsultService;
use app\service\logic\common\order\OrderMultiService;
use app\validate\common\order\ConsultValidate;
use app\validate\common\order\MultiValidate;
use think\App;
use think\response\Json;
use think\db\exception\DbException;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;

class MultiController extends ApiController
{
    protected $service;

    public function __construct(App $app, OrderMultiService $service)
    {
        parent::__construct($app);

        $this->service = $service;
    }

    /**
     * 查看结果
     *
     * @return Json
     * @throws DataNotFoundException
     * @throws LogicException
     * @throws ModelNotFoundException
     */
    public function result()
    {
        $params = $this->request->param();
        $this->validate($params, MultiValidate::class . '.result');

        $result = $this->service->result($params);
        return amis($result);
    }
}
